package com.cy.pj.sys.controller;

import com.cy.pj.common.util.PageUtil;
import com.cy.pj.common.web.pojo.JsonResult;
import com.cy.pj.sys.pojo.CGBLog;
import com.cy.pj.sys.service.CGBLogsService;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/log/")
public class CGBLogsController {
    @Autowired
    private CGBLogsService cgbLogsService;

    @GetMapping("{id}")
    public JsonResult doFindById(@PathVariable Long id){
        return new JsonResult(cgbLogsService.findById(id));
    }

    @DeleteMapping("{id}")
    public JsonResult doDeleteById(@PathVariable Long...ids){
        cgbLogsService.deleteById(ids);
        return new JsonResult("delete ok");
    }
    @GetMapping
    public JsonResult doFindLogs(CGBLog cgbLog){
        return new JsonResult(PageUtil.startPage()
        .doSelectPageInfo(()->{
            cgbLogsService.findLogs(cgbLog);
        }));
    }



}
